<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head lang="zh-cn">
<meta charset="UTF-8" />
<meta name="viewport"
	content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-touch-fullscreen" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no" />
<meta name="description" content="厚和尚品" />
<meta name="keywords" content="厚和尚品" />
<title>待付款的订单</title>
<link rel="apple-touch-icon-precomposed" href="" />
<link rel="apple-touch-startup-image" href="" />
<link rel="stylesheet" href="mall/css/css.css"
	th:href="@{/mall/css/css.css}" />
<link rel="stylesheet" href="mall/lib/layer/layer_mobile/need/layer.css"
	th:href="@{/mall/lib/layer/layer_mobile/need/layer.css}" />
<script type="text/javascript" src="mall/lib/zpeto/zepto-1.2.0.min.js"
	th:src="@{/mall/lib/zpeto/zepto-1.2.0.min.js}"></script>
<script type="text/javascript"
	src="mall/lib/layer/layer_mobile/layer.js"
	th:src="@{/mall/lib/layer/layer_mobile/layer.js}"></script>
<script type="text/javascript" src="mall/js/comm.js"
	th:src="@{/mall/js/comm.js}"></script>
<script type="text/javascript" src="mall/js/pingpp.js"
	th:src="@{/mall/js/pingpp.js}"></script>
</head>
<body>
	<form id="cartform" method="post" th:action="@{/member/dopay}">
		<input type="hidden" th:field="${orderInfo.remark}" /> <input
			type="hidden" th:field="${orderInfo.transAmt}" /> <input
			type="hidden" th:field="${orderInfo.transBonus}" /> <input
			type="hidden" th:field="${orderInfo.memberId}" /> <input
			type="hidden" th:field="${orderInfo.addrId}" />
			<input
			type="hidden" th:field="${orderInfo.openId}" />
			<input
			type="hidden" th:field="${orderInfo.payChannel}" />
	</form>

	<script type="text/javascript">
		$(function(){
			$.ajax({
				type : "POST",
				dataType : "json",
				url : "/member/dopay",
				data : $('#cartform').serialize(),
				success:function(rst){
					if(typeof(rst.result) == 'undefined'){
						pingpp.createPayment(rst, function(result, err){
						    if (result == "success") {
						        // 只有微信公众账号 wx_pub 支付成功的结果会在这里返回，其他的支付结果都会跳转到 extra 中对应的 URL。
						        window.location.href='http://www.houheshangpin.com/member/main';
						    } else if (result == "fail") {
						        // charge 不正确或者微信公众账号支付失败时会在此处返回
						    	window.location.href='http://www.houheshangpin.com';
						    } else if (result == "cancel") {
						        // 微信公众账号支付取消支付
						    	window.location.href='http://www.houheshangpin.com';
						    }
						});
					}
					
				},
				error : function(XMLHttpRequest,textStatus,errorThrown){
					layer.open({
						content : '系统异常',
						skin : 'msg',
						time : 2
					//2秒后自动关闭
					});
				}
			});
		});
		
	</script>
</body>
</html>